from src.bean.base_enum import BaseEnum


class ColPacketLen(BaseEnum):
    packet_len_total_count = ('packet_len_total_count', '包大小分段：session中包大小的总和')
    packet_len_total_average = ('packet_len_total_average', '包大小分段：session中包大小的均值')
    packet_len_total_min = ('packet_len_total_min', '包大小分段：session中包大小的最小值')
    packet_len_total_max = ('packet_len_total_max', '包大小分段：session中包大小的最大值')
    packet_len_total_rate = ('packet_len_total_rate', '包大小分段：session中总时间内包大小')
    packet_len_total_percent = ('packet_len_total_percent', '包大小分段：包大小占总session包大小的比例')
    packet_len_0_19_count = ('packet_len_0_19_count', '包大小分段：包大小在0-19区间内的数量')
    packet_len_0_19_average = ('packet_len_0_19_average', '包大小分段：包大小在0-19区间内的均值')
    packet_len_0_19_min = ('packet_len_0_19_min', '包大小分段：包大小在0-19区间内的最小值')
    packet_len_0_19_max = ('packet_len_0_19_max', '包大小分段：包大小在0-19区间内的最大值')
    packet_len_0_19_rate = ('packet_len_0_19_rate', '包大小分段：包大小在0-19区间内占session总包大小的比例')
    packet_len_0_19_percent = ('packet_len_0_19_percent', '包大小分段：包大小在0-19区间内占session总包大小的比例')

    packet_len_20_39_count = ('packet_len_20_39_count', '包大小分段：包大小在20-39区间内的数量')
    packet_len_20_39_average = ('packet_len_20_39_average', '包大小分段：包大小在20-39区间内的均值')
    packet_len_20_39_min = ('packet_len_20_39_min', '包大小分段：包大小在20-39区间内的最小值')
    packet_len_20_39_max = ('packet_len_20_39_max', '包大小分段：包大小在20-39区间内的最大值')
    packet_len_20_39_rate = ('packet_len_20_39_rate', '包大小分段：包大小在20-39区间内占session总包大小的比例')
    packet_len_20_39_percent = ('packet_len_20_39_percent', '包大小分段：包大小在20-39区间内占总session包大小的比例')

    packet_len_40_79_count = ('packet_len_40_79_count', '包大小分段：包大小在40-79区间内的数量')
    packet_len_40_79_average = ('packet_len_40_79_average', '包大小分段：包大小在40-79区间内的均值')
    packet_len_40_79_min = ('packet_len_40_79_min', '包大小分段：包大小在40-79区间内的最小值')
    packet_len_40_79_max = ('packet_len_40_79_max', '包大小分段：包大小在40-79区间内的最大值')
    packet_len_40_79_rate = ('packet_len_40_79_rate', '包大小分段：包大小在40-79区间内占session总包大小的比例')
    packet_len_40_79_percent = ('packet_len_40_79_percent', '包大小分段：包大小在40-79区间内占总session包大小的比例')

    packet_len_80_159_count = ('packet_len_80_159_count', '包大小分段：包大小在80-159区间内的数量')
    packet_len_80_159_average = ('packet_len_80_159_average', '包大小分段：包大小在80-159区间内的均值')
    packet_len_80_159_min = ('packet_len_80_159_min', '包大小分段：包大小在80-159区间内的最小值')
    packet_len_80_159_max = ('packet_len_80_159_max', '包大小分段：包大小在80-159区间内的最大值')
    packet_len_80_159_rate = ('packet_len_80_159_rate', '包大小分段：包大小在80-159区间内占session总包大小的比例')
    packet_len_80_159_percent = ('packet_len_80_159_percent', '包大小分段：包大小在80-159区间内占总session包大小的比例')

    packet_len_160_319_count = ('packet_len_160_319_count', '包大小分段：包大小在160-319区间内的数量')
    packet_len_160_319_average = ('packet_len_160_319_average', '包大小分段：包大小在160-319区间内的均值')
    packet_len_160_319_min = ('packet_len_160_319_min', '包大小分段：包大小在160-319区间内的最小值')
    packet_len_160_319_max = ('packet_len_160_319_max', '包大小分段：包大小在160-319区间内的最大值')
    packet_len_160_319_rate = ('packet_len_160_319_rate', '包大小分段：包大小在160-319区间内占session总包大小的比例')
    packet_len_160_319_percent = ('packet_len_160_319_percent',
                                  '包大小分段：包大小在160-319区间内占总session包大小的比例')

    packet_len_320_639_count = ('packet_len_320_639_count', '包大小分段：包大小在320-639区间内的数量')
    packet_len_320_639_average = ('packet_len_320_639_average', '包大小分段：包大小在320-639区间内的均值')
    packet_len_320_639_min = ('packet_len_320_639_min', '包大小分段：包大小在320-639区间内的最小值')
    packet_len_320_639_max = ('packet_len_320_639_max', '包大小分段：包大小在320-639区间内的最大值')
    packet_len_320_639_rate = ('packet_len_320_639_rate', '包大小分段：包大小在320-639区间内占session总包大小的比例')
    packet_len_320_639_percent = ('packet_len_320_639_percent',
                                  '包大小分段：包大小在320-639区间内占总session包大小的比例')

    packet_len_640_1279_count = ('packet_len_640_1279_count', '包大小分段：包大小在640-1279区间内的数量')
    packet_len_640_1279_average = ('packet_len_640_1279_average', '包大小分段：包大小在640-1279区间内的均值')
    packet_len_640_1279_min = ('packet_len_640_1279_min', '包大小分段：包大小在640-1279区间内的最小值')
    packet_len_640_1279_max = ('packet_len_640_1279_max', '包大小分段：包大小在640-1279区间内的最大值')
    packet_len_640_1279_rate = ('packet_len_640_1279_rate', '包大小分段：包大小在640-1279区间内占session总包大小的比例')
    packet_len_640_1279_percent = ('packet_len_640_1279_percent',
                                   '包大小分段：包大小在640-1279区间内占总session包大小的比例')

    packet_len_1280_2559_count = ('packet_len_1280_2559_count', '包大小分段：包大小在1280-2559区间内的数量')
    packet_len_1280_2559_average = ('packet_len_1280_2559_average', '包大小分段：包大小在1280-2559区间内的均值')
    packet_len_1280_2559_min = ('packet_len_1280_2559_min', '包大小分段：包大小在1280-2559区间内的最小值')
    packet_len_1280_2559_max = ('packet_len_1280_2559_max', '包大小分段：包大小在1280-2559区间内的最大值')
    packet_len_1280_2559_rate = ('packet_len_1280_2559_rate',
                                 '包大小分段：包大小在1280-2559区间内占session总包大小的比例')
    packet_len_1280_2559_percent = ('packet_len_1280_2559_percent',
                                    '包大小分段：包大小在1280-2559区间内占总session包大小的比例')

    packet_len_2560_5119_count = ('packet_len_2560_5119_count', '包大小分段：包大小在2560-5119区间内的数量')
    packet_len_2560_5119_average = ('packet_len_2560_5119_average', '包大小分段：包大小在2560-5119区间内的均值')
    packet_len_2560_5119_min = ('packet_len_2560_5119_min', '包大小分段：包大小在2560-5119区间内的最小值')
    packet_len_2560_5119_max = ('packet_len_2560_5119_max', '包大小分段：包大小在2560-5119区间内的最大值')
    packet_len_2560_5119_rate = ('packet_len_2560_5119_rate',
                                 '包大小分段：包大小在2560-5119区间内占session总包大小的比例')
    packet_len_2560_5119_percent = ('packet_len_2560_5119_percent',
                                    '包大小分段：包大小在2560-5119区间内占总session包大小的比例')

    packet_len_more_than_5120_count = ('packet_len_more_than_5120_count', '包大小分段：包大小大于5120的数量')
    packet_len_more_than_5120_average = ('packet_len_more_than_5120_average', '包大小分段：包大小大于5120的均值')
    packet_len_more_than_5120_min = ('packet_len_more_than_5120_min', '包大小分段：包大小大于5120的最小值')
    packet_len_more_than_5120_max = ('packet_len_more_than_5120_max', '包大小分段：包大小大于5120的最大值')
    packet_len_more_than_5120_rate = ('packet_len_more_than_5120_rate',
                                      '包大小分段：包大小大于5120占session总包大小的比例')
    packet_len_more_than_5120_percent = ('packet_len_more_than_5120_percent',
                                         '包大小分段：包大小大于5120占总session包大小的比例')


class ColUAEnum(BaseEnum):
    UserAgent_is_attack = ('UserAgent_is_attack', 'UA是否包含威胁')
    UserAgent_is_enterprise = ('UserAgent_is_enterprise', 'UA是否包含公司')
    UserAgent_browser = ('UserAgent_browser', 'UA中浏览器名称')
    UserAgent_browser_version = ('UserAgent_browser_version', 'UA中浏览器版本')
    UserAgent_os = ('UserAgent_os', 'UA中当前系统名称')
    UserAgent_os_version = ('UserAgent_os_version', 'UA中当前系统版本')
    UserAgent_device_type = ('UserAgent_device_type', 'UA中设备类型')
    UserAgent_platform = ('UserAgent_platform', 'UA中平台信息')
    UserAgent_is_bot = ('UserAgent_is_bot', 'UA中是否含有机器人自动化相关字段')
    UserAgent_language = ('UserAgent_language', 'UA中包含的语言')
    UserAgent_special_char_count = ('UserAgent_special_char_count', 'UA中是否包含特殊字符')
    UserAgent_is_unknown = ('UserAgent_is_unknown',
                            '''data[['UserAgent_browser', 'UserAgent_os', 'UserAgent_platform']].isna().any(axis=1).fillna("Unknown")''')


class ColZValue(BaseEnum):
    network_bytes_z_score = ('network.bytes_z_score', '计算该字段的Z值')
    source_bytes_z_score = ('source.bytes_z_score', '计算该字段的Z值')
    destination_bytes_z_score = ('destination.bytes_z_score', '计算该字段的Z值')
    totDataBytes_z_score = ('totDataBytes_z_score', '计算该字段的Z值')
    http_requestHeaderCnt_z_score = ('http.requestHeaderCnt_z_score', '计算该字段的Z值')
    http_responseHeaderCnt_z_score = ('http.responseHeaderCnt_z_score', '计算该字段的Z值')
    source_packets_z_score = ('source.packets_z_score', '计算该字段的Z值')
    destination_packets_z_score = ('destination.packets_z_score', '计算该字段的Z值')
    network_packets_z_score = ('network.packets_z_score', '计算该字段的Z值')


class MinusMean(BaseEnum):
    network_bytes_minus_mean = ('network.bytes_minus_mean', '计算该字段减去全局缓存中对应的均值')
    source_bytes_minus_mean = ('source.bytes_minus_mean', '计算该字段减去全局缓存中对应的均值')
    destination_bytes_minus_mean = ('destination.bytes_minus_mean', '计算该字段减去全局缓存中对应的均值')
    totDataBytes_minus_mean = ('totDataBytes_minus_mean', '计算该字段减去全局缓存中对应的均值')
    http_requestHeaderCnt_minus_mean = ('http.requestHeaderCnt_minus_mean', '计算该字段减去全局缓存中对应的均值')
    http_responseHeaderCnt_minus_mean = ('http.responseHeaderCnt_minus_mean', '计算该字段减去全局缓存中对应的均值')
    source_packets_minus_mean = ('source.packets_minus_mean', '计算该字段减去全局缓存中对应的均值')
    destination_packets_minus_mean = ('destination.packets_minus_mean', '计算该字段减去全局缓存中对应的均值')
    network_packets_minus_mean = ('network.packets_minus_mean', '计算该字段减去全局缓存中对应的均值')


class ColURI(BaseEnum):
    URI_FEATURES_EXTRA_param_count = ('URI_FEATURES_EXTRA_param_count', 'URI特征：参数数量')
    URI_FEATURES_EXTRA_path_depth = ('URI_FEATURES_EXTRA_path_depth', 'URI特征：路径深度')
    URI_FEATURES_EXTRA_param_length_avg = ('URI_FEATURES_EXTRA_param_length_avg', 'URI特征：参数长度均值')
    URI_FEATURES_EXTRA_param_length_max = ('URI_FEATURES_EXTRA_param_length_max', 'URI特征：参数长度最大值')
    URI_FEATURES_EXTRA_contains_sql = ('URI_FEATURES_EXTRA_contains_sql', 'URI特征：是否包含sql')
    URI_FEATURES_EXTRA_contains_xss = ('URI_FEATURES_EXTRA_contains_xss', 'URI特征：是否包含xss')
    URI_FEATURES_EXTRA_contains_cmd = ('URI_FEATURES_EXTRA_contains_cmd', 'URI特征：是否包含cmd')
    URI_FEATURES_EXTRA_contains_path = ('URI_FEATURES_EXTRA_contains_path', 'URI特征：是否包含路径')
    URI_FEATURES_EXTRA_contains_redirect = ('URI_FEATURES_EXTRA_contains_redirect', 'URI特征：是否包含路径')
    URI_FEATURES_EXTRA_contains_danger = ('URI_FEATURES_EXTRA_contains_danger', 'URI特征：是否包含威胁字段')
    URI_FEATURES_EXTRA_contains_suspicious_ext = ('URI_FEATURES_EXTRA_contains_suspicious_ext',
                                                  'URI特征：是否包含特殊字符')


class ColExist(BaseEnum):
    sql_injection_exist = ('sql_injection_exist', '是否有sql注入的字段')
    cmd_injection_exist = ('cmd_injection_exist', '是否有命令注入的字段')
    xxe_attack_exist = ('xxe_attack_exist', '是否有xxe攻击的字段')
    xss_attack_exist = ('xss_attack_exist', '是否有xss攻击的字段')
    sensitive_data_exist = ('sensitive_data_exist', '是否有敏感数据')
    deserialize_exist = ('deserialize_exist', '是否有序列化字段')
    log_injection_exist = ('log_injection_exist', '是否有日志注入的字段')


class Count(BaseEnum):
    sql_injection_count = ('sql_injection_count', 'sql注入的字段的数量')
    cmd_injection_count = ('cmd_injection_count', '命令注入的字段的数量')
    xxe_attack_count = ('xxe_attack_count', 'xxe攻击的字段的数量')
    xss_attack_count = ('xss_attack_count', 'xss攻击的字段的数量')
    sensitive_data_count = ('sensitive_data_count', '敏感数据字段的数量')
    deserialize_count = ('deserialize_count', '反序列化字段的数量')
    log_injection_count = ('log_injection_count', '日志注入的字段的数量')


class PacketSize(BaseEnum):
    packet_size_mean = ('packet_size_mean', '包大小的均值')
    packet_size_variance = ('packet_size_variance', '包大小的方差')


class HttpUri(BaseEnum):
    http_uri_length_mean = ('http.uri_length_mean', 'URI长度的均值')
    http_uri_length_var = ('http.uri_length_var', 'URI长度的方差')
    http_uri_depth_mean = ('http.uri_depth_mean', 'URI路径深度的均值')
    http_uri_depth_var = ('http.uri_depth_var', 'URI路径深度的方差')
    http_uri_filename_length_mean = ('http.uri_filename_length_mean', 'URI中文件名长度的均值')
    http_uri_filename_length_var = ('http.uri_filename_length_var', 'URI中文件名长度的方差')


class ColSession(BaseEnum):
    id = ('id', '来自session原数据的id')
    node = ('node', '来自session原数据的节点')
    segmentCnt = ('segmentCnt', '来自session原数据的段数量')
    tcpflags_rst = ('tcpflags.rst', '来自session原数据的TCP RST标志位')
    tcpflags_ack = ('tcpflags.ack', '来自session原数据的TCP ACK标志位')
    tcpflags_syn = ('tcpflags.syn', '来自session原数据的TCP SYN标志位')
    tcpflags_urg = ('tcpflags.urg', '来自session原数据的TCP URG标志位')
    tcpflags_psh = ('tcpflags.psh', '来自session原数据的TCP PSH标志位')
    tcpflags_syn_ack = ('tcpflags.syn-ack', '来自session原数据的TCP SYN-ACK标志位')
    tcpflags_fin = ('tcpflags.fin', '来自session原数据的TCP FIN标志位')
    source_ip = ('source.ip', '来自session原数据的源IP')
    destination_ip = ('destination.ip', '来自session原数据的目的IP')
    source_port = ('source.port', '来自session原数据的源端口')
    destination_port = ('destination.port', '来自session原数据的目的端口')
    source_packets = ('source.packets', '来自session原数据的源发送包数')
    source_bytes = ('source.bytes', '来自session原数据的源发送字节数')
    destination_packets = ('destination.packets', '来自session原数据的目的发送包数')
    destination_bytes = ('destination.bytes', '来自session原数据的目的发送字节数')
    initRTT = ('initRTT', '来自session原数据的初始RTT')
    firstPacket = ('firstPacket', '来自session原数据的第一个包时间')
    lastPacket = ('lastPacket', '来自session原数据的最后一个包时间')
    ipProtocol = ('ipProtocol', '来自session原数据的IP协议')
    protocolCnt = ('protocolCnt', '来自session原数据的协议数量')
    protocol = ('protocol', '来自session原数据的协议类型')
    server_bytes = ('server.bytes', '来自session原数据的服务器端字节数')
    totDataBytes = ('totDataBytes', '来自session原数据的总数据字节数')
    network_packets = ('network.packets', '来自session原数据的网络层包数')
    network_bytes = ('network.bytes', '来自session原数据的网络层字节数')
    length = ('length', '来自session原数据的会话持续时间')
    client_bytes = ('client.bytes', '来自session原数据的客户端字节数')
    packetPos = ('packetPos', '来自session原数据的包位置')

    # HTTP相关
    http_uri = ('http.uri', '来自session原数据的URI')
    http_uriCnt = ('http.uriCnt', '来自session原数据的URI计数')
    http_path = ('http.path', '来自session原数据的路径')
    http_pathCnt = ('http.pathCnt', '来自session原数据的路径计数')
    http_host = ('http.host', '来自session原数据的主机')
    http_hostCnt = ('http.hostCnt', '来自session原数据的主机计数')
    http_method = ('http.method', '来自session原数据的HTTP方法')
    http_methodCnt = ('http.methodCnt', '来自session原数据的HTTP方法计数')
    http_method_GET = ('http.method-GET', '来自session原数据的GET方法标志')
    http_method_POST = ('http.method-POST', '来自session原数据的POST方法标志')
    http_key = ('http.key', '来自session原数据的HTTP关键字段')
    http_keyCnt = ('http.keyCnt', '来自session原数据的HTTP关键字段计数')
    http_useragent = ('http.useragent', '来自session原数据的User-Agent')
    http_useragentCnt = ('http.useragentCnt', '来自session原数据的User-Agent计数')
    http_statuscode = ('http.statuscode', '来自session原数据的HTTP状态码')
    http_statuscodeCnt = ('http.statuscodeCnt', '来自session原数据的HTTP状态码计数')
    http_bodyMagic = ('http.bodyMagic', '来自session原数据的HTTP正文魔数')
    http_bodyMagicCnt = ('http.bodyMagicCnt', '来自session原数据的HTTP正文魔数计数')
    http_clientVersion = ('http.clientVersion', '来自session原数据的客户端版本')
    http_clientVersionCnt = ('http.clientVersionCnt', '来自session原数据的客户端版本计数')
    http_serverVersion = ('http.serverVersion', '来自session原数据的服务器版本')
    http_serverVersionCnt = ('http.serverVersionCnt', '来自session原数据的服务器版本计数')
    http_requestHeader = ('http.requestHeader', '来自session原数据的请求头')
    http_requestHeaderCnt = ('http.requestHeaderCnt', '来自session原数据的请求头计数')
    http_responseHeader = ('http.responseHeader', '来自session原数据的响应头')
    http_responseHeaderCnt = ('http.responseHeaderCnt', '来自session原数据的响应头计数')
    http_response_content_type = ('http.response-content-type', '来自session原数据的响应Content-Type')
    http_response_content_typeCnt = ('http.response-content-typeCnt', '来自session原数据的响应Content-Type计数')
    http_request_content_type = ('http.request-content-type', '来自session原数据的请求Content-Type')
    http_request_referer = ('http.request-referer', '来自session原数据的Referer')
    http_request_refererCnt = ('http.request-refererCnt', '来自session原数据的Referer计数')
    http_response_server = ('http.response-server', '来自session原数据的响应服务器')
    http_xffIp = ('http.xffIp', '来自session原数据的XFF IP')
    http_xffIpCnt = ('http.xffIpCnt', '来自session原数据的XFF IP计数')
    http_hostTokens = ('http.hostTokens', '来自session原数据的host token')

    # DNS相关
    dns_ASN = ('dns.ASN', '来自session原数据的ASN信息')
    dns_RIR = ('dns.RIR', '来自session原数据的RIR区域')
    dns_GEO = ('dns.GEO', '来自session原数据的地理信息')
    dns_alpn = ('dns.alpn', '来自session原数据的ALPN协议')
    dns_alpnCnt = ('dns.alpnCnt', '来自session原数据的ALPN协议计数')
    dns_ip = ('dns.ip', '来自session原数据的DNS解析IP')
    dns_ipCnt = ('dns.ipCnt', '来自session原数据的DNS解析IP计数')
    dns_OpCode = ('dns.OpCode', '来自session原数据的DNS操作码')
    dns_OpCodeCnt = ('dns.OpCodeCnt', '来自session原数据的DNS操作码计数')
    dns_Puny = ('dns.Puny', '来自session原数据的PunyCode域名')
    dns_PunyCnt = ('dns.PunyCnt', '来自session原数据的PunyCode域名计数')
    dns_QueryClass = ('dns.QueryClass', '来自session原数据的DNS查询类')
    dns_QueryClassCnt = ('dns.QueryClassCnt', '来自session原数据的DNS查询类计数')
    dns_QueryType = ('dns.QueryType', '来自session原数据的DNS查询类型')
    dns_QueryTypeCnt = ('dns.QueryTypeCnt', '来自session原数据的DNS查询类型计数')
    dns_status = ('dns.status', '来自session原数据的DNS状态')
    dns_statusCnt = ('dns.statusCnt', '来自session原数据的DNS状态计数')
    dns_host = ('dns.host', '来自session原数据的DNS主机')
    dns_hostCnt = ('dns.hostCnt', '来自session原数据的DNS主机计数')

    # TLS相关
    tls_cipher = ('tls.cipher', '来自session原数据的TLS加密套件')
    tls_cipherCnt = ('tls.cipherCnt', '来自session原数据的TLS加密套件计数')
    tls_dstSessionId = ('tls.dstSessionId', '来自session原数据的TLS目标会话ID')
    tls_srcSessionId = ('tls.srcSessionId', '来自session原数据的TLS源会话ID')
    tls_version = ('tls.version', '来自session原数据的TLS协议版本')
    tls_versionCnt = ('tls.versionCnt', '来自session原数据的TLS协议版本计数')
    tls_ja3 = ('tls.ja3', '来自session原数据的JA3指纹')
    tls_ja3Cnt = ('tls.ja3Cnt', '来自session原数据的JA3指纹计数')
    tls_ja3s = ('tls.ja3s', '来自session原数据的JA3S指纹')
    tls_ja3sCnt = ('tls.ja3sCnt', '来自session原数据的JA3S指纹计数')
    tls_ja4 = ('tls.ja4', '来自session原数据的JA4指纹')
    tls_ja4Cnt = ('tls.ja4Cnt', '来自session原数据的JA4指纹计数')
    tls_ja4_r = ('tls.ja4_r', '来自session原数据的JA4_r指纹')
    tls_ja4_rCnt = ('tls.ja4_rCnt', '来自session原数据的JA4_r指纹计数')
